package com.shujia.java.day11.demo4;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class CollectionTest {
    public static void main(String[] args) {
        Collection coll=new ArrayList();
        Student student = new Student("张三");
        Student student1 = new Student("李四");
        Student student2 = new Student("王五");

        //添加student
        coll.add(student);
        coll.add(student1);
        coll.add(student2);
        coll.remove(student);
        //循环遍历 Object和coll里面的数据类型保持一致
        for (Object o : coll) {
            //类型转化 向下
            Student s=(Student) o;
            //获取getName
            System.out.println(s.getName());
        }
    }
}
